package com.zp.qualitypractice.MVP2;



import java.util.List;

/**
 * Created by yiuhet on 2017/5/22.
 */

public class ZhihuPresenter extends BasePresenter<MVPContract.ZhihuView> implements MVPContract.ZhihuPresenter,OnZhihuLatestListener{
    /*Presenter作为中间层，持有View和Model的引用*/
    private MVPContract.ZhihuView mZhihuView;
    private ZhihuLatestModelImp1 zhihuLatestModelImp1;


    public ZhihuPresenter(MVPContract.ZhihuView zhihuView) {
        mZhihuView = zhihuView;
        zhihuLatestModelImp1 = new ZhihuLatestModelImp1();
    }

    public List<ZhihuLatest.StoriesEntity> getmZhihuLatestList() {
        return zhihuLatestModelImp1.getmZhihuLatestList();
    }
    @Override
    public void getLatest() {
        mZhihuView.onStartGetData();
        zhihuLatestModelImp1.loadZhihuLatest(this);
    }

    @Override
    public void getMore() {
        mZhihuView.onStartGetData();
        zhihuLatestModelImp1.loadMore(this);
    }


    @Override
    public void onLoadZhihuLatestSuccess() {
        mZhihuView.onGetZhihuLatestSuccess();
    }

    @Override
    public void onLoadMoreSuccess() {
        mZhihuView.onGetMoreSuccess();
    }


    @Override
    public void onLoadDataError(String error) {
        mZhihuView.onGetDataFailed(error);
    }

}
